package com.dilean.impl.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.dilean.api.model.AttributeList;
import com.dilean.api.model.AttributeListValue;

@Entity
@Table(name = "ATTR_LIST_VALUES")
public class AttributeListValueImpl implements AttributeListValue {

	 @Id
	    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "DILEAN_ID_SEQ")
	    @SequenceGenerator(name = "DILEAN_ID_SEQ", sequenceName = "DILEAN_ID_SEQ", allocationSize = 1)
	    @Column(name = "ID")
	    private Integer id;

	    @Column(name = "NAME", unique = false, nullable = false)
	    private String name;
	    
	    @Column(name = "ORDER_NUMBER", unique = false, nullable = false)
	    private int orderNumber;

	    @ManyToOne(targetEntity = AttributeListImpl.class)
	    @JoinColumn(name="LIST_ID")
	    private AttributeList attrList;

	    @Override
	    public Integer getId()
	    {
	        return id;
	    }

	    @Override
	    public String getName()
	    {
	        return name;
	    }

	    @Override
	    public void setId(Integer id)
	    {
	        this.id = id;
	    }

	    @Override
	    public void setName(String name)
	    {
	        this.name = name;
	    }

		@Override
		public int getOrderNumber() {
			return orderNumber;
		}

		@Override
		public AttributeList getAttrList() {
			return attrList;
		}

		@Override
		public void setOrderNumber(int orderNumber) {
			this.orderNumber = orderNumber;
		}

		@Override
		public void setAttrList(AttributeList attributeList) {
			this.attrList = attributeList;
		}

		@Override
		public String toString()
		{
			return getName();
		}
}
